home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Visual Basic new SourceCode and Projects / Barcode Generator 2.0 / Printfrm.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2000-06-24  |  10.5 KB  |  270 lines

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  3. Begin VB.Form Printfrm 
  4.    BorderStyle     =   4  'Festes Werkzeugfenster
  5.    Caption         =   "Print"
  6.    ClientHeight    =   2790
  7.    ClientLeft      =   45
  8.    ClientTop       =   285
  9.    ClientWidth     =   3090
  10.    LinkTopic       =   "Form1"
  11.    LockControls    =   -1  'True
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   2790
  15.    ScaleWidth      =   3090
  16.    ShowInTaskbar   =   0   'False
  17.    StartUpPosition =   3  'Windows-Standard
  18.    Begin MSComDlg.CommonDialog CD1 
  19.       Left            =   2520
  20.       Top             =   2280
  21.       _ExtentX        =   847
  22.       _ExtentY        =   847
  23.       _Version        =   393216
  24.    End
  25.    Begin VB.Frame Frame2 
  26.       Caption         =   "Pages"
  27.       Height          =   1095
  28.       Left            =   120
  29.       TabIndex        =   6
  30.       Top             =   1080
  31.       Width           =   2415
  32.       Begin VB.OptionButton Oppc 
  33.          Caption         =   "One Page per code"
  34.          Height          =   255
  35.          Left            =   120
  36.          TabIndex        =   8
  37.          Top             =   720
  38.          Width           =   2055
  39.       End
  40.       Begin VB.OptionButton Opfa 
  41.          Caption         =   "One Page for all"
  42.          Height          =   255
  43.          Left            =   120
  44.          TabIndex        =   7
  45.          Top             =   360
  46.          Value           =   -1  'True
  47.          Width           =   1455
  48.       End
  49.    End
  50.    Begin VB.Frame Frame1 
  51.       Caption         =   "Print"
  52.       Height          =   855
  53.       Left            =   120
  54.       TabIndex        =   3
  55.       Top             =   120
  56.       Width           =   1455
  57.       Begin VB.OptionButton Selected 
  58.          Caption         =   "Selected"
  59.          Height          =   255
  60.          Left            =   120
  61.          TabIndex        =   5
  62.          Top             =   480
  63.          Width           =   1215
  64.       End
  65.       Begin VB.OptionButton All 
  66.          Caption         =   "All"
  67.          Height          =   255
  68.          Left            =   120
  69.          TabIndex        =   4
  70.          Top             =   240
  71.          Value           =   -1  'True
  72.          Width           =   855
  73.       End
  74.    End
  75.    Begin VB.CommandButton Command3 
  76.       Caption         =   "Options..."
  77.       Height          =   375
  78.       Left            =   120
  79.       TabIndex        =   2
  80.       Top             =   2280
  81.       Width           =   1335
  82.    End
  83.    Begin VB.CommandButton Command2 
  84.       Cancel          =   -1  'True
  85.       Caption         =   "Exit"
  86.       Height          =   375
  87.       Left            =   1680
  88.       TabIndex        =   1
  89.       Top             =   600
  90.       Width           =   1335
  91.    End
  92.    Begin VB.CommandButton Command1 
  93.       Caption         =   "Preview..."
  94.       Default         =   -1  'True
  95.       Height          =   375
  96.       Left            =   1680
  97.       TabIndex        =   0
  98.       Top             =   120
  99.       Width           =   1335
  100.    End
  101. Attribute VB_Name = "Printfrm"
  102. Attribute VB_GlobalNameSpace = False
  103. Attribute VB_Creatable = False
  104. Attribute VB_PredeclaredId = True
  105. Attribute VB_Exposed = False
  106. Private Sub All_Click()
  107. If Selected.Value = True Then
  108.     Opfa.Enabled = False
  109.     Oppc.Enabled = False
  110.     Opfa.Enabled = True
  111.     Oppc.Enabled = True
  112. End If
  113. End Sub
  114. Private Sub Command1_Click()
  115. If Selected.Value = True Then
  116.     Mainfrm.ActiveForm.PrintForm
  117. ElseIf All.Value = True Then
  118.     If Oppc.Value = True Then
  119.         For A = 1 To UBound(bcode)
  120.             If FState(bcode(A).Tag).Deleted <> True Then
  121.                 bcode(A).PrintForm
  122.             End If
  123.         Next
  124.     ElseIf Opfa.Value = True Then
  125.         printpreview.Show
  126.         Dim reihe
  127.         Dim z
  128.         Dim B
  129.         Dim D
  130.         ghez = 0
  131.         pl = 0
  132.         For A = 1 To UBound(bcode)
  133. StartX:
  134.         If bcode(A).isEAN = False Then
  135.             MsgBox "Print preview currently only supports EAN-Codes", vbCritical, "Error"
  136.             A = A + 1
  137.             If A > UBound(bcode) Then
  138.                 Exit For
  139.             End If
  140.             GoTo StartX
  141.         ElseIf FState(bcode(A).Tag).Deleted = True Then
  142.             A = A + 1
  143.             If A > UBound(bcode) Then
  144.                 Exit For
  145.             End If
  146.             GoTo StartX
  147.         End If
  148.         fi = bcode(A).Label1.Caption
  149.         se = bcode(A).Label2.Caption
  150.         th = bcode(A).Label3.Caption
  151.         If A = 1 Then
  152.             printpreview.Label1(0).Caption = fi
  153.             printpreview.Label2(0).Caption = se
  154.             printpreview.Label3(0).Caption = th
  155.         ElseIf A > 1 Then
  156.             Load printpreview.Label1(A - 1)
  157.             Load printpreview.Label2(A - 1)
  158.             Load printpreview.Label3(A - 1)
  159.             If ppvoptions.showtitle.Value = True Then
  160.                 Load printpreview.Label4(A - 1)
  161.                 printpreview.Label4(A - 1).Caption = bcode(A).Caption
  162.             End If
  163.             printpreview.Label1(A - 1).Caption = fi
  164.             printpreview.Label2(A - 1).Caption = se
  165.             printpreview.Label3(A - 1).Caption = th
  166.             If (A - 1) Mod ppvoptions.rowtext.text <> 0 Then
  167.                 printpreview.Label1(A - 1).Left = printpreview.Label1(A - 2).Left
  168.                 printpreview.Label2(A - 1).Left = printpreview.Label2(A - 2).Left
  169.                 printpreview.Label3(A - 1).Left = printpreview.Label3(A - 2).Left
  170.                 printpreview.Label1(A - 1).Top = printpreview.Label1(A - 2).Top + 50
  171.                 printpreview.Label2(A - 1).Top = printpreview.Label2(A - 2).Top + 50
  172.                 printpreview.Label3(A - 1).Top = printpreview.Label3(A - 2).Top + 50
  173.                 If ppvoptions.showtitle.Value = True Then
  174.                     printpreview.Label4(A - 1).Left = printpreview.Label4(A - 2).Left
  175.                     printpreview.Label4(A - 1).Top = printpreview.Label4(A - 2).Top + 50
  176.                     printpreview.Label4(A - 1).Visible = True
  177.                 End If
  178.             Else
  179.                 printpreview.Label1(A - 1).Left = printpreview.Label1(A - 2).Left + 120
  180.                 printpreview.Label2(A - 1).Left = printpreview.Label2(A - 2).Left + 120
  181.                 printpreview.Label3(A - 1).Left = printpreview.Label3(A - 2).Left + 120
  182.                 printpreview.Label1(A - 1).Top = 20
  183.                 printpreview.Label2(A - 1).Top = 20
  184.                 printpreview.Label3(A - 1).Top = 20
  185.                 If ppvoptions.showtitle.Value = True Then
  186.                     printpreview.Label4(A - 1).Left = printpreview.Label4(A - 2).Left + 120
  187.                     printpreview.Label4(A - 1).Top = 32
  188.                     printpreview.Label4(A - 1).Visible = True
  189.                 End If
  190.             End If
  191.             printpreview.Label1(A - 1).Visible = True
  192.             printpreview.Label2(A - 1).Visible = True
  193.             printpreview.Label3(A - 1).Visible = True
  194.         End If
  195.         reihe = 0
  196.         z = 0
  197.         B = 0
  198.         D = 0
  199.         printpreview.Line (1 + 10 + ghez, 0 + pl)-(1 + 10 + ghez, 25 + pl) 'Paint the First two lines on the begin of the Code
  200.         printpreview.Line (3 + 10 + ghez, 0 + pl)-(3 + 10 + ghez, 25 + pl)
  201.         reihe = code(fi)
  202.         For z = 1 To 6 'Use A and B code to Decode the Barcode 'For each 6 numbers use 7 Lines 6 * 7 = 47 Lines
  203.             If Mid(reihe, z, 1) = "A" Then 'Code A
  204.                 B = CodeAToByte(Mid(se, z, 1))
  205.                 For D = 1 To 7 'Paint the 7 Lines (A Code)
  206.                     If Mid(B, D, 1) = 1 Then 'On all 7 numbers Check if it is a 1 or a 0 and Paint a Black or a White Line
  207.                         printpreview.Line ((z - 1) * 7 + D + 3 + 10 + ghez, 0 + pl)-((z - 1) * 7 + D + 3 + 10 + ghez, 20 + pl), &H0 'Black Line
  208.                     Else
  209.                         printpreview.Line ((z - 1) * 7 + D + 3 + 10 + ghez, 0 + pl)-((z - 1) * 7 + D + 3 + 10 + ghez, 20 + pl), &HFFFFFF 'White Line
  210.                     End If
  211.                 Next
  212.             ElseIf Mid(reihe, z, 1) = "B" Then 'Code B
  213.                 B = CodeBToByte(Mid(se, z, 1))
  214.                 For D = 1 To 7 'Paint the 7 Lines (B Code)
  215.                     If Mid(B, D, 1) = 1 Then 'On all 7 numbers Check if it is a 1 or a 0 and Paint a Black or a White Line
  216.                         printpreview.Line ((z - 1) * 7 + D + 3 + 10 + ghez, 0 + pl)-((z - 1) * 7 + D + 3 + 10 + ghez, 20 + pl), &H0 'Black Line
  217.                     Else
  218.                         printpreview.Line ((z - 1) * 7 + D + 3 + 10 + ghez, 0 + pl)-((z - 1) * 7 + D + 3 + 10 + ghez, 20 + pl), &HFFFFFF 'White Line
  219.                     End If
  220.                 Next
  221.             End If
  222.         Next
  223.         printpreview.Line (6 * 7 + 5 + 10 + ghez, 0 + pl)-(6 * 7 + 5 + 10 + ghez, 25 + pl) 'Paint the middle two lines of the Code
  224.         printpreview.Line (6 * 7 + 7 + 10 + ghez, 0 + pl)-(6 * 7 + 7 + 10 + ghez, 25 + pl)
  225.             For z = 1 To 6 'Use C code to Decode the Barcode 'For each 6 numbers use 7 Lines 6 * 7 = 47 Lines
  226.                 B = CodeCToByte(Mid(th, z, 1)) ' Code C
  227.                 For D = 1 To 7 'Paint the 7 Lines (C Code)
  228.                     If Mid(B, D, 1) = 1 Then 'On all 7 numbers Check if it is a 1 or a 0 and Paint a Black or a White Line
  229.                         printpreview.Line ((z - 1) * 7 + D + 50 + 10 + ghez, 0 + pl)-((z - 1) * 7 + D + 50 + 10 + ghez, 20 + pl), &H0 'Black Line
  230.                     Else
  231.                         printpreview.Line ((z - 1) * 7 + D + 50 + 10 + ghez, 0 + pl)-((z - 1) * 7 + D + 50 + 10 + ghez, 20 + pl), &HFFFFFF 'White Line
  232.                     End If
  233.                 Next
  234.             Next
  235.         printpreview.Line (94 + 9 + ghez, 0 + pl)-(94 + 9 + ghez, 25 + pl) 'The Last two lines
  236.         printpreview.Line (96 + 9 + ghez, 0 + pl)-(96 + 9 + ghez, 25 + pl)
  237.         pl = pl + 50
  238.         If A Mod ppvoptions.rowtext.text = 0 Then
  239.             pl = 0
  240.             ghez = ghez + 120
  241.         End If
  242.         Next
  243.     End If
  244. End If
  245. End Sub
  246. Private Sub Command2_Click()
  247. Unload ppvoptions
  248. Unload Me
  249. End Sub
  250. Private Sub Command3_Click()
  251. CD1.ShowPrinter
  252. End Sub
  253. Private Sub Form_Unload(Cancel As Integer)
  254. Unload ppvoptions
  255. End Sub
  256. Private Sub Opfa_Click()
  257. Command1.Caption = "Preview..."
  258. End Sub
  259. Private Sub Oppc_Click()
  260. Command1.Caption = "Print"
  261. End Sub
  262. Private Sub Selected_Click()
  263. If Selected.Value = True Then
  264.     Opfa.Enabled = False
  265.     Oppc.Enabled = False
  266.     Opfa.Enabled = True
  267.     Oppc.Enabled = True
  268. End If
  269. End Sub
  270.